package com.example.mymicaihu.fragment;

import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;

import com.example.mvplibrary.ui.fragment.BaseMvpFragment;
import com.example.mymicaihu.R;
import com.example.mymicaihu.adapter.FragTabAdapter;
import com.example.mymicaihu.callback.Mainconcations;
import com.example.mymicaihu.fragment.network.FocusFragment;
import com.example.mymicaihu.fragment.network.LegionFragment;
import com.example.mymicaihu.fragment.network.WorkFragment;
import com.example.mymicaihu.model.MainModel;
import com.example.mymicaihu.presenter.MainPresenter;
import com.google.android.material.tabs.TabLayout;

import java.util.ArrayList;

import butterknife.BindView;

/**
 * 作者：朱勇闯
 * data : 2021/3/29  14:30
 * 作用： 话题关注
 */
public class NetWorkFragment<T> extends BaseMvpFragment<Mainconcations.MainView, MainModel, MainPresenter<T>> implements Mainconcations.MainView {
    @BindView(R.id.tab_fragment_network)
    TabLayout tab;
    @BindView(R.id.vp_fragment_network)
    ViewPager viewPager;

    @Override
    protected MainPresenter<T> createPresenter() {
        return new MainPresenter();
    }

    @Override
    protected void initEvent() {
        WorkFragment workFragment = new WorkFragment();
        LegionFragment legionFragment = new LegionFragment();
        FocusFragment focusFragment1 = new FocusFragment();
        ArrayList<String> list = new ArrayList<>();
        list.add("话题");
        list.add("军团");
        list.add("关注");
        ArrayList<Fragment> fragments = new ArrayList<>();
        fragments.add(workFragment);
        fragments.add(legionFragment);
        fragments.add(focusFragment1);

        FragTabAdapter fragTabAdapter = new FragTabAdapter(getChildFragmentManager(), fragments, list);
        viewPager.setAdapter(fragTabAdapter);
        tab.setupWithViewPager(viewPager);
    }

    @Override
    protected int createLayoutId() {
        return R.layout.fragment_network;
    }

    @Override
    public void showList(Object o, int type) {

    }

    @Override
    public void showError(String error) {

    }

    @Override
    public void showProgressbar() {

    }

    @Override
    public void hideProgressbar() {

    }
}
